function DayDetail(dayModel, locationText, activity, secondActivity, locationCache) {
    this._dayModel = dayModel;
    this._locationText = locationText;
    this._locationCache = locationCache || pwc.locationCache;
    this._location = this._locationCache.getByFullName(locationText);
    this._activity = activity;
    this._secondActivity = secondActivity;
    
    this._error = new Error();
    this._events = [];
}

DayDetail.prototype = {
    addEvent: function(dayEvent) {
        this._events.push(dayEvent);
    },
    
    isValid: function() {
        if (this._dayModel.hasTravel()) {
            return true;
        }
        
        if (this._isLocationRedundant() || this._locationNameNotExist()) {
            this._error.addError(i18n("MSG_LOCATION_INVALID"), DayDetailDialogViewMap.location + this.locationViewIndex || 0);
        }
        
        return !this._error.hasError();
    },

    _isLocationRedundant: function(){
        return this._location && this._location.isRedundantLocation();
    },

    _locationNameNotExist: function(){
        return !this._location && this._locationText != "";
    },

    getError: function() {
        return this._error;
    },

    createAction: function() {
        return new DayDetailAction(this._dayModel, this._location, this._activity, this._secondActivity);
    },
    
    setEvents: function(events) {
        this._events = events;
    }
};